import redis
import logging
class Config(object):
    SECRET_KEY = " "
    DEBUG=True
    # 数据库配置
    SQLALCHEMY_DATABASE_URI="mysql://root:mysql@localhost:3306/info15"
    SQLALCHEMY_TRACK_MODIFICATIONS=False
    SQLALCHEMY_COMMIT_ON_TEARDOWN=True #视图函数结束,失去连接的时候,会自动提交

    # redis配置
    REDIS_HOST="localhost"
    REDIS_PROT=6379

    # session

    SESSION_TYPE="redis"
    SESSION_USE_SIGNER=True
    SESSION_REDIS=redis.StrictRedis(host=REDIS_HOST,port=REDIS_PROT)
    PERMANENT_SESSION_LIFETIME=3600*24*2
    # 日志文件配置
    #设置日志等级默认就是DEBUG
    LEVEL=logging.DEBUG
#开发环境
class DevelopConfig(Config):
    pass

#生产环境
class ProductConfig(Config):
    DEBUG = False
    LEVEL=logging.ERROR
class TestConfig():
    TESTING=True

config_dict={
    "develop":DevelopConfig,
    "product":ProductConfig,
    "test":TestConfig
}